Ext.define('qjtravel.view.HomeBig', {
    extend: 'Ext.Panel',
    xtype: 'homeBig',
    requires: [
        'Ext.carousel.Carousel',
        'Ext.List', 'Ext.TitleBar'
    ],
    config: {
        style: 'background:#000',
        layout: 'vbox',
        items: [
            {
                xtype: 'toolbar',
                ui: 'dark',
                docked: 'top',
                title: ' 首页',
                flex:1
            },
            {
                xtype: 'dataview',
                id: 'click_category1',
                store: 'Category',
                emptyText: '',
                flex: 2,
                scrollable: false,
                listeners: {
                    painted: function (dataview) {
                        var category = Ext.getStore('Category');
                        if (category.find('cadid', 6) == -1) {
                            category.load({
                                params: {
                                    cadid: 6
                                }
                            });
                        }
                    }
                }
            }
        ],
        listeners: {
            initialize:function(){
                var clientHeight=document.body.clientHeight;
                var c= clientHeight - 125;
                Ext.getCmp('click_category1').setHeight(c);
                var dataH = Ext.getCmp("click_category1").getHeight();
                var dataViewDivHeight=dataH*0.333-2;
                Ext.getCmp("click_category1").setItemTpl('<div class="homeCategoryItem1" style="height:'+dataViewDivHeight+'px"><img src="{iconUrl}"/><span class="homeCategoryItemSpan">{name}</span></div>');
            },
            painted:function(){
                //适配大屏代码
                var toolbars=Ext.ComponentQuery.query("toolbar")
                Ext.ComponentQuery.query("toolbar")[1].setHeight(80+"px")
                var tabs=Ext.ComponentQuery.query("tab");
                Ext.each(tabs,function(items1){
                    items1.setHeight(80+"px")
                    items1.setStyle("padding-top: 5px;")
                })
                var clientW = document.body.clientWidth;
                if (clientW > 599) {
                    var btns = document.getElementsByClassName("x-button-label");
                    //console.log(btns)
                    Ext.each(btns, function (items, index) {
                        var btnText=items.innerText;
                        if(btnText=="首页"||btnText=="地图导航"||btnText=="旅游攻略"||btnText=="旅游签到"||btnText=="更多"){
                            items.setAttribute("style", "font-size:1.3em;margin:10px auto;line-height:30px;");
                        }
                    });
                }
            }

        }
    }
});